import com.bosssoft.hr.train.mybatis.demo.User;
import com.bosssoft.hr.train.mybatis.mapper.UserMapper;
import com.bosssoft.hr.train.mybatis.service.UserService;
import com.bosssoft.hr.train.mybatis.service.UserServiceImpl;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;
import java.util.Date;

/**
 * @Author: wang
 * @Time: 2022/3/10
 */
public class test {
    UserService userService=new UserServiceImpl();

    @Test
    public void addUser(){
        User user=new User();
        user.setName("汪志强");
        user.setBirthday(new Date());
        System.out.println(userService.save(user));
    }

    @Test
    public void deleteUser(){
        User user=new User();
        user.setId(1);
        System.out.println(userService.remove(user));
    }

    @Test
    public void updateUser(){
        User user=new User();
        user.setId(2);
        user.setBirthday( new Date(120,03,10));
        user.setName("赵四");
        System.out.println(userService.update(user));
    }

    @Test
    public void findName(){
        System.out.println(userService.findByName("汪志强"));
    }

}
